home *** CD-ROM | disk | FTP | other *** search
- /* strspn.c From TC Bible page 299 Use strspn to locate the position of the
- first character in a string that does not belong to the set of characters
- in another. */
-
-
-
- #include <stdio.h>
- #include <string.h>
-
- char *whitespace = " \t\n"; /* space, tab, and new line are the
- whitespace characters */
- main()
- {
- int loc;
- char str1[80];
- printf("Enter a string with preceding blanks: ");
- gets(str1);
- loc = strspn(str1, whitespace);
- printf("First non-whitespace character in \n%s\nis at location %d\n",
- str1, loc);
- }